package com.yanxu;

/**
 * @author 折戟沉沙铁未销
 * @version V1.0
 * @date 2024/11/13-2024
 * @Description: 这里用一句话描述这个类的作用
 */
public class FinallyExecute {
    public static void main(String[] args) {
        Thread thread1 = new Thread(new Runnable() {
            public void run() {
                try {
                    System.out.println(Thread.currentThread().getName()+ " 子线程执行任务逻辑!!!");
                } catch (Exception e) {
                    e.printStackTrace();
                } finally {
                    System.out.println(Thread.currentThread().getName() + " 执行finally!!!");
                }
            }
        });

        thread1.start();

        System.out.println("主线程执行任务逻辑!!!");
    }

    public static void main1(String[] args) {
        try {
            System.out.println("do somethings");
        }catch (Exception e){
            e.printStackTrace();
        }finally {
            //main 线程执的
            System.out.println(Thread.currentThread().getName()+" 执行finally!!!");
        }
    }
}